import { JXDef } from "../../../conventions/JXCommon";
import { GCtrl } from "../../../Core/GCtrl";
import GParam from "../../../Core/GEvent/GParam";
import GChild from "../../../Core/GView/GChild";
import { AudioMgr } from "../../../Core/Manager/AudioMgr";
import { JXColor } from "../../Common/JXColor";
import { VIEW_ID } from "../../Common/UI";
import { JXLocales } from "../../Common/Zh";
import { REquireItem } from "../../Data/RunTime/RunRaw/RItemAttach";
import RJXItem from "../../Data/RunTime/RunRaw/RJXItem";
import GameMgr from "../../Logic/GameMgr";
import { CMsg, EQUIP_PART, ITEM_DETAIL_FLAG, ITEM_TYPE, PILL, SQUAD_BUTTON } from './../../Common/Define';
import { LCoin, LNumberInEn } from './../../Common/Language';
import { Res } from './../../Common/UIResources';

const { ccclass, property, menu, executeInEditMode } = cc._decorator;
@ccclass @menu('View/Common/JXItem')

export default class JXItem extends GChild {
    @property(cc.Sprite) icon: cc.Sprite = null;
    @property(cc.Sprite) bg: cc.Sprite = null;
    @property(cc.Label) numLb: cc.Label = null;
    @property(cc.Label) eqLvLb: cc.Label = null;
    @property(cc.Label) eqlv1: cc.Label = null;

    @property(cc.Node) light: cc.Node = null;
    @property(cc.Label) eqName: cc.Label = null;
    @property(cc.Label) eq: cc.Label = null;
    @property(cc.Label) eqNumLb: cc.Label = null;

    @property(cc.Node) light1: cc.Node = null;

    @property(cc.Node) mask: cc.Node = null;
    @property(cc.Sprite) heroChip: cc.Sprite = null;

    @property({ type: cc.Node, tooltip: "宝库展示圆圈" }) round: cc.Node = null;
    @property({ type: cc.Label, tooltip: "宝库展示等级显示" }) eqLvLbRound: cc.Label = null;

    /**英雄热数据 */
    private _IHeroData: IHeroData = null;
    /**装备名称 */
    protected _equipNameArr = [];
    public static NAME = "Item";
    /**数据 */
    private data: RJXItem = null;
    /**图标旗帜 */
    private _flag: number = 0;
    /**图标索引 */
    private _index: number = 0;
    /**外部回调 */
    protected _cb: any;

    /**装备图标是否使用 */
    protected _equipUse: boolean = false;

    public get equipUse() {
        return this._equipUse;
    }

    public set equipUse(v) {
        this._equipUse = v;
    }

    /**装备id */
    protected _equipId: string = null;
    /**装备穿戴槽位 */
    protected _equipSlot: number[] = [];
    protected _touchMove: boolean = false;
    protected _dragShowNode: cc.Node = null;
    protected _touchBegin: boolean = false;
    protected _canPutOn: boolean = false;
    protected _isDraging: boolean = false;
    protected _onSeat: boolean = false;
    protected _seatNode: cc.Node[] = [];
    protected _heroId: number = null;
    protected _delEquip: cc.Node = null;
    public onGLoad(): void {
        this.numLb.node.on(cc.Node.EventType.SIZE_CHANGED, this.onNumLabelSizeChange, this);
        this.initCarName();
    }

    start(): void {

    }

    public setView(data: RJXItem, flag: number = ITEM_DETAIL_FLAG.TPL, cb?: any, equipId?: string) {
        this.setDefault();
        this._cb = cb;
        this.data = data;
        this._flag = flag;
        if (equipId) {
            this._equipId = equipId;
        }



        if (!data.raw && this.data.type == ITEM_TYPE.HERO && flag & ITEM_DETAIL_FLAG.LIGHT) {
            if (flag & ITEM_DETAIL_FLAG.SHOWLIGHT) {
                this.light.active = true;
            }
            let heroData = GameMgr.heroData.getRaw<SHeroDataRaw>(this.data.id);
            this.light1.active = true;
            this.eqName.string = heroData.name;
            this.eq.string = 'x';
            this.eqNumLb.string = LNumberInEn(this.data.num);
            this.numLb.node.active = false;
            this.icon.node.scale = 0.12;
            this.assetImpl.spriteAtlasFrame(this.bg, Res.texture.views.common, "quality_" + heroData.trait)
            this.assetImpl.spriteFrame(this.icon, Res.texture.hero.hero + heroData.icon);
        }

        if (!data.raw) return;
        if (flag & ITEM_DETAIL_FLAG.NULLICON) {
            this.icon.node.active = false;
            this.eqlv1.node.active = false;
        }
        let allHero = GameMgr.rHeroData.getHaveHeros(SQUAD_BUTTON.ALL);
        let num = allHero.have.length + allHero.notHave.length;

        if (Number(this.data.id) > 1000 && Number(this.data.id) <= (1000 + num)) {

        } else {
            this.assetImpl.spriteAtlasFrame(this.icon, Res.texture.views.icon, this.data.icon)
        }
        if (flag & ITEM_DETAIL_FLAG.NO_BG) {
            this.bg.node.active = false;
        }

        if (flag & ITEM_DETAIL_FLAG.MATERIAL_STYLE_LINE) {
            this.icon.node.scale = 0.5;
        }

        if (flag & ITEM_DETAIL_FLAG.NO_NUM) {
            this.numLb.node.active = false;
        } else {
            this.numLb.node.active = true;
        }

        if (flag & ITEM_DETAIL_FLAG.NUMPOS_ITEM_BC) {
            this.numLb.node.anchorX = 0.5;
            this.numLb.fontSize = 30
            this.numLb.node.position = cc.v2(0, -35);

        }

        if (flag & ITEM_DETAIL_FLAG.ICON_SCALE) {
            this.icon.node.scale = 0.8;
        }

        if (flag & ITEM_DETAIL_FLAG.NUM_SCALE) {
            // 先做2层缩放检测
            let scale = this.node.scale;
            if (this.node.parent) {
                scale *= this.node.parent.scale;
            }
            this.numLb.node.scale = 1 / scale;
        }

        if (flag & ITEM_DETAIL_FLAG.BAG || flag & ITEM_DETAIL_FLAG.TPL) {
            this.numLb.string = LNumberInEn(data.num)
        } else if (flag & ITEM_DETAIL_FLAG.MATERIAL) {
            let result: ItemCostResult = GameMgr.itemMgr.testCost(this.data, 1);
            this.setNumLb(result);
        }

        if (flag & ITEM_DETAIL_FLAG.NO_BG_SHOWSLV) {
            this.eqlv1.node.active = true;
            this.eqlv1.node.x = -40;
            this.eqlv1.node.y = 45;
            this.bg.node.active = false;
        }
        if (this._flag & ITEM_DETAIL_FLAG.TOUCH || this._flag & ITEM_DETAIL_FLAG.BLESS) {
            this.eqlv1.node.active = true;
            // console.log("ITEM_DETAIL_FLAG.TOUCH");
        }
        if (this._flag & ITEM_DETAIL_FLAG.NULLICON) {
            this.eqlv1.node.active = false;
            // console.log("ITEM_DETAIL_FLAG.NULLICON");

        }

        if (data.type == ITEM_TYPE.EQUIPDATA) {
            let attach: REquireItem = data.attach as REquireItem;
            this.numLb.string = this.data.attach ? "" : data.num.toString();
            this.assetImpl.spriteAtlasFrame(this.bg, Res.texture.views.common, "quality_" + this.data.quality);
            // console.log("attach.itemData.raw", attach, 'data.raw', data.raw);
            this.eqlv1.string = attach ? "Lv." + attach.itemData.raw.lv + '' : "Lv." + data.raw.lv;
            this.eqLvLbRound.string = attach ? attach.itemData.raw.lv + '' : "" + data.raw.lv;
            if (this._flag & ITEM_DETAIL_FLAG.NO_BG | flag & ITEM_DETAIL_FLAG.NO_SLV) {
                this.eqLvLb.node.active = false;
            } else {
                this.eqLvLb.node.active = !!attach;
                this.eqLvLb.string = attach ? ("+" + attach.sLv.toString()) : "Lv.";

                if (this._flag & ITEM_DETAIL_FLAG.BLESS || this._flag & ITEM_DETAIL_FLAG.TOUCH || (flag & ITEM_DETAIL_FLAG.NO_BG_SHOWSLV)) {

                    if (attach.sLv > 0) {
                        this.eqLvLb.node.setPosition(-16, -23);
                    } else {

                        this.eqLvLb.node.active = false;
                    }


                    if ((flag & ITEM_DETAIL_FLAG.NO_BG_SHOWSLV)) {
                        this.eqLvLb.node.setPosition(-25, -40);
                        this.eqLvLb.node.setScale(1.2);
                    }
                }
            }

        } else if (!(this._flag & ITEM_DETAIL_FLAG.NO_BG)) {
            if (this.data.quality) {
                this.assetImpl.spriteAtlasFrame(this.bg, Res.texture.views.common, "quality_" + this.data.quality);
            } else {
                this.assetImpl.spriteAtlasFrame(this.bg, Res.texture.views.common, "quality_" + 1);
                if (this.data.id >= PILL.PILL0 && this.data.id <= PILL.PILL5) {
                    this.assetImpl.spriteAtlasFrame(this.bg, Res.texture.views.common, "quality_" + (this.data.id - 200));
                }
                if (this.data.type == ITEM_TYPE.PROP) {
                    let allHero = GameMgr.rHeroData.getHaveHeros(SQUAD_BUTTON.ALL);
                    let num = allHero.have.length + allHero.notHave.length;
                    if (this.data.id >= 1001 && this.data.id <= (1000 + num)) {
                        this.assetImpl.spriteAtlasFrame(this.icon, Res.texture.views.icon, 'icon_plane');
                        this.mask.active = true;
                        this.assetImpl.spriteFrame(this.heroChip, Res.texture.hero.hero + this.data.id);
                    }
                }
            }

        }

        if (flag & ITEM_DETAIL_FLAG.TOUCH) {
            let attach: REquireItem = data.attach as REquireItem;
            this.assetImpl.spriteAtlasFrame(this.bg, Res.texture.views.common, "quality_" + attach.quality)
            this.numLb.node.active = false;
        }

        if (flag & ITEM_DETAIL_FLAG.BLESS) {
            let attach: REquireItem = data.attach as REquireItem;
            this.assetImpl.spriteAtlasFrame(this.bg, Res.texture.views.common, "quality_" + attach.quality)
            this.numLb.node.active = false;
        }

        if (flag & ITEM_DETAIL_FLAG.SCALEICON) {
            // this.eqlv1.node.active = true;
            // this.eqlv1.node.x = -40;
            // this.eqlv1.node.y = 45;
            this.round.active = true;
            this.icon.node.setScale(1.2);
        }

        if (flag & ITEM_DETAIL_FLAG.SCALEBLESSICON) {
            this.icon.node.setScale(1.8);
        }

        if (flag & ITEM_DETAIL_FLAG.FONTHECHENG) {

        }


        if (flag & ITEM_DETAIL_FLAG.SHOWLIGHT) {
            this.light.active = true;
        }

        let btn: cc.Button = this.node.getComponent(cc.Button);
        if (btn) {
            btn.enabled = !(flag & ITEM_DETAIL_FLAG.NOT_TOUCH);
        }

        if (this._flag & ITEM_DETAIL_FLAG.LVFONTCHANGE) {
            this.assetImpl.font(Res.font.fzcy, (font) => {
                this.numLb.font = font;
            })
        }

        if (this._flag & ITEM_DETAIL_FLAG.FONTHECHENG) {
            this.assetImpl.font(Res.font.mnpw, (font) => {
                this.numLb.font = font;
            })
        }

        if (flag & ITEM_DETAIL_FLAG.LIGHT) {
            this.light1.active = true;
            this.eqName.string = this.data.raw.name;
            this.eq.string = 'x';
            this.eqNumLb.string = LNumberInEn(data.num);
            this.numLb.node.active = false;
            this.icon.node.scale = 0.6;
        }



        if (this.data.type == ITEM_TYPE.PROP && (flag & ITEM_DETAIL_FLAG.STOREHERO)) {
            this.round.active = false;
            this.numLb.node.active = false;
            this.icon.node.scale = 0.8;
            this.eqlv1.node.active = false;
            this.eqLvLb.node.active = false;
            if (this.data.type == ITEM_TYPE.PROP) {
                let allHero = GameMgr.rHeroData.getHaveHeros(SQUAD_BUTTON.ALL);
                let num = allHero.have.length + allHero.notHave.length;
                if (this.data.id >= 1001 && this.data.id <= (1000 + num)) {
                    this.assetImpl.spriteAtlasFrame(this.icon, Res.texture.views.icon, 'icon_plane');
                    this.mask.active = true;
                    this.assetImpl.spriteFrame(this.heroChip, Res.texture.hero.hero + this.data.id);
                }
            }
        }

        if (flag & ITEM_DETAIL_FLAG.STORECHIPHIDE) {
            this.mask.active = false;
        }
    }

    public setNumLb(result: ItemCostResult) {
        if (this._flag & ITEM_DETAIL_FLAG.MATERIAL_NO_HAVE) {
            //let ret: string = `<color=${result.enough ? JXColor.Cffffff.toHEX() : JXColor.Cffffff.toHEX()}>${result.need}</c>`// JXColor.C925600.toHEX()  JXColor.CFF003D.toHEX()
            let ret = result.need;
            this.numLb.node.color = JXColor.Cffffff;
            this.numLb.string = LCoin(ret);
            this.numLb.node.addComponent(cc.LabelOutline);
            let line = this.numLb.node.getComponent(cc.LabelOutline);
            line.width = 2;
            line.color = JXColor.C000000;
            this.numLb.node.scale = 0.8;

        } else {
            //后面的数字
            let b: string = `<color=${result.enough ? JXColor.C925600.toHEX() : JXColor.CFF003D.toHEX()}>${LNumberInEn(result.cur)}</c>`
            let t: string = `<color=${JXColor.C925600.toHEX()}>${LNumberInEn(result.need)}</c>`;
            this.numLb.string = b + "|" + t;
        }
        this.onNumLabelSizeChange();
    }

    protected onNumLabelSizeChange() {
        if ((this._flag & ITEM_DETAIL_FLAG.ICON_SCALE) && (this._flag & ITEM_DETAIL_FLAG.MATERIAL)) {
            // 默认给个15的偏移值
            let iconWidth = this.icon.node.width / 2 + 15;
            this.node.height = this.icon.node.height / 2;
            this.node.width = iconWidth + this.numLb.node.width;
            this.icon.node.x = (iconWidth - this.node.width) / 2 - 10;
            this.numLb.node.anchorX = 0;
            this.numLb.node.y = -2;
            this.numLb.lineHeight = 26;
            this.numLb.fontSize = 26;
            this.numLb.node.x = this.icon.node.x + iconWidth / 2 + 5;
            this.icon.node.setScale(0.35);
        }


    }

    protected setDefault() {
        this.data = null;
        let atlas = Res.texture.views.heroDetail;
        this.assetImpl.spriteAtlasFrame(this.bg, atlas, 'equipBottom');
        this.icon.spriteFrame = null;
        this.eqLvLb.node.active = false;
        this.numLb.node.active = false
    }


    public cancelTouch() {
        if (!(this._flag & ITEM_DETAIL_FLAG.NOT_TOUCH)) {
            this._flag |= ITEM_DETAIL_FLAG.NOT_TOUCH;
            this.node.getComponent(cc.Button).enabled = false;
        }
    }


    public onClick() {
        if (this._cb) {
            this._cb(this);
            return;
        }
        if (!this.data) return;
        if (this._flag & ITEM_DETAIL_FLAG.NOT_OP) return;
    }



    /****************************************装备*****************************************/

    /**设置拖拽 */
    public setTouch(IHeroData: IHeroData, seatNode: Array<cc.Node>, del?: cc.Node) {
        this._IHeroData = IHeroData;
        this._heroId = this._IHeroData.tableId;
        //设置终点位置
        this._seatNode = seatNode;
        this.checkStatus();
        this.initEvent();
        if (del) {
            this._delEquip = del;
            this._seatNode.push(this._delEquip);
        }
    }



    /**初始触摸事件监听 */
    protected initEvent() {
        this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchStar, this);
        this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this);
        this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnd, this);
        this.node.on(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this);
    }

    /**初始触摸事件关闭 */
    public initOffEvent() {
        this.node.off(cc.Node.EventType.TOUCH_START, this._onTouchStar, this);
        this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMove, this);
        this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnd, this);
        this.node.off(cc.Node.EventType.TOUCH_CANCEL, this._onTouchCancel, this);
    }

    /**移除 */
    protected destroyDragNode() {
        if (cc.isValid(this._dragShowNode)) {
            this._dragShowNode.destroy();
            this._dragShowNode = null;
        }
    }

    /**命中图标穿上装备 */
    protected replaceData(equipId: string, heroId: number, site: number) {
        let equip = GameMgr.RBagData.getEquipDataById(equipId);
        // console.log('命中图标穿上装备', equip);
        if (equip.itemData.raw.seat == site || (EQUIP_PART.BINGSHU1 == equip.itemData.raw.seat && site >= EQUIP_PART.BINGSHU1)) {
            let info: EquipPutInfo = {
                equipId: equipId,
                heroId: heroId,
                site: site,
            }
            let itemLv = GameMgr.RBagData.getEquipDataById(equipId).itemData.raw.lv;
            if (this._IHeroData.lv >= itemLv) {
                // console.log('穿戴装备', site, this._data.isFirstExp);
                if (!equip.isFirstExp) {
                    let info: HeroAddExp = {
                        heroId: this._IHeroData.tableId,
                        exp: equip.itemData.raw.exp
                    }
                    GameMgr.RBagData.setIsFirstExp(equip.insId);
                    GCtrl.ES.emit(CMsg.client.hero.onHeroAddExp, new GParam(info))
                }
                var heroArr = GameMgr.suitData.getAllHeroSuit(this._IHeroData.tableId);
                var suitArr: SSuitDataRaw = GameMgr.suitData.getHeroSuit(equip.equipId, heroArr);

                let suitInfo: suitInfo = {
                    IHeroData: this._IHeroData,
                    suit: suitArr
                }
                AudioMgr.Ins().playEffect(Res.audio.addEquip);
                GCtrl.ES.emit(CMsg.client.hero.onAddSuit, new GParam(suitInfo));
                GCtrl.ES.emit(CMsg.client.equip.onEquipPutOn, new GParam(info))
            } else {
                // GameMgr.uiMgr.showToast(JXLocales.tip.equipLv);
                let lvData: SLvDataRaw = GameMgr.lvData.getIdByInfo(GameMgr.RBagData.getEquipDataById(equipId).itemData.raw.lv);

                let str = '英雄等级不足，需要英雄达到' + this._equipNameArr[lvData.quality - 1] + lvData.showLv + '级';
                GameMgr.uiMgr.showToast(str);//JXLocales.tip.lvNO
            }

        } else {
            GameMgr.uiMgr.showToast(JXLocales.tip.equip);
        }
    }


    /**初始化卡牌品质名称 */
    protected initCarName() {
        let white = GameMgr.systemConfig.value(JXDef.SYS_CONFIG_KEY.white);
        this._equipNameArr.push(white);
        let green = GameMgr.systemConfig.value(JXDef.SYS_CONFIG_KEY.green);
        this._equipNameArr.push(green);
        let Blue = GameMgr.systemConfig.value(JXDef.SYS_CONFIG_KEY.Blue);
        this._equipNameArr.push(Blue);
        let purple = GameMgr.systemConfig.value(JXDef.SYS_CONFIG_KEY.purple);
        this._equipNameArr.push(purple);
        let orange = GameMgr.systemConfig.value(JXDef.SYS_CONFIG_KEY.orange);
        this._equipNameArr.push(orange);
        let red = GameMgr.systemConfig.value(JXDef.SYS_CONFIG_KEY.red);
        this._equipNameArr.push(red);
    }

    protected pushEquip(equipId: string, heroId: number, site: number) {
        let equip = GameMgr.RBagData.getEquipDataById(equipId);
        let info: EquipPutInfo = {
            equipId: equipId,
            heroId: heroId,
            site: site,
        }
        GCtrl.ES.emit(CMsg.client.equip.onBlessEquip, new GParam(info))
    }

    /**检查状态 */
    protected checkStatus() {
        if (!this.data) {
            this._canPutOn = false;
        } else {
            this._canPutOn = true;
        }
    }

    protected _onTouchStar(event: cc.Event.EventTouch) {
        this._touchMove = false;
        this.destroyDragNode();
        this._touchBegin = true;
        event.stopPropagation();
    }

    protected _onTouchMove(event: cc.Event.EventTouch) {
        if (!this._canPutOn) {
            return;
        }
        let deltaMove = event.getLocation().sub(event.getStartLocation());
        if (!this._isDraging) {
            this._isDraging = true;
        }
        if (deltaMove.mag() > 7 && this._isDraging) {
            let parent = this._seatNode[0].parent;
            if (!this._touchMove) {
                this._touchMove = true;
                this._dragShowNode = cc.instantiate(this.icon.node);
                this._dragShowNode.active = true;

                if (this._flag & ITEM_DETAIL_FLAG.BLESS | ITEM_DETAIL_FLAG.ICON_SCALE) {
                    if (this._seatNode[0].parent.parent.active) {
                        this._dragShowNode.parent = this._seatNode[0].parent;
                    } else if (this._seatNode[2].parent.active) {
                        this._dragShowNode.parent = this._seatNode[2];
                    }
                } else {
                    this._dragShowNode.parent = this._seatNode[0].parent;
                }
                let localPos: cc.Vec2 = parent.convertToNodeSpaceAR(event.getLocation());
                this._dragShowNode.setPosition(localPos);
            } else {
                let worldPos = event.getLocation();
                let localPos: cc.Vec2 = parent.convertToNodeSpaceAR(worldPos);
                this._dragShowNode.setPosition(localPos);
                if (this.node.parent.name == 'content') {
                    this.node.parent.parent.parent.getComponent(cc.ScrollView).enabled = false;
                }

                let result = this.checkIsEnter(worldPos);
                if (result.isEnter) {
                    if (!this._onSeat) {
                        // console.log("进入区域", result.index);
                        this._onSeat = true;
                    }
                } else {
                    if (this._onSeat) {
                        // console.log("离开区域");
                        this._onSeat = false;
                    }
                }

            }
        }
    }

    protected checkIsEnter(worldPos) {
        let index = null;
        let isEnter = false;
        for (let i = 0; i < this._seatNode.length; i++) {
            let node = this._seatNode[i];
            isEnter = node.getBoundingBoxToWorld().contains(worldPos)
            if (isEnter) {
                index = i;
                // console.log(index);

                break;
            }
        }
        return { isEnter, index }
    }

    protected _onTouchEnd(event: cc.Event.EventTouch, isCancel = false) {
        let worldPos = event.getLocation();
        this.destroyDragNode();
        if (this._touchMove) {
            let result = this.checkIsEnter(worldPos);
            if (result.isEnter) {
                // console.log("命中", result.index);


                if (this._flag & ITEM_DETAIL_FLAG.TOUCH) {
                    if (result.index > 5) {
                        this.recovery();
                    } else {
                        this.replaceData(this._equipId, this._heroId, result.index);
                    }

                }

                if (this._flag & ITEM_DETAIL_FLAG.BLESS) {
                    if (result.index > 3) {
                        this.recovery();
                    } else {
                        this.pushEquip(this._equipId, this._heroId, result.index);
                    }

                }


            } else {
                // console.log("弹开未选中");
            }
        } else {
            if (isCancel == false) {
                // console.log("点击");
            }
            this.destroyDragNode();
        }

        if (this.node.parent.name == 'content') {
            this.node.parent.parent.parent.getComponent(cc.ScrollView).enabled = true;
        }
        this._touchBegin = false;
        this._touchMove = false;
        this._onSeat = false;
        this._isDraging = false;
    }

    protected _onTouchCancel(event: cc.Event.EventTouch) {
        this._onTouchEnd(event, true);
    }

    /**回收装备 */
    protected recovery() {


        if (this.data.raw) {
            let recycle = this.data.raw.recycle;
            let result = GameMgr.itemMgr.testCost(recycle);
            if (result) {


                let cost = recycle;
                GameMgr.jumpToMgr.jumpGoTo(VIEW_ID.currencyFrame, cost, 1, true, this._equipId);

                // GCtrl.ES.emit(CMsg.client.bag.onBagItemChange, [recycle])
                // GCtrl.ES.emit(CMsg.client.equip.ondelEquip, this._equipId);
            }
            // console.log('回收装备', recycle);
        }

    }

    /****************************************装备*****************************************/
}   